home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Ext
/
GCSound
/
GCSound.gc
< prev
next >
Wrap
Text File
|
1999-04-21
|
17KB
|
659 lines
G4C
WINBIG 40 11 233 220 'GCSound 8SVX Player'
WinType 11110001
; ===============================================================
; general events
; ===============================================================
xOnLoad
mode = DIR ; can be SAMPLE or DIR
selswitch = 0 ; delect/deselect dir lv switch
setgad #this 10 hide ; hide the samples lv
setgad gcsound.gc 2 HIDE ; and it's text box
extract gcsound.gc guipath mypath ; save lists of files -
JoinFile $mypath Lists prefs ; in my dir/Lists
joinfile $prefs List_1 prefs
GuiOpen #this
name = '' ; set these for safety
volume = 64
speed = -1
times = 0
status = IDLE
setwin = CLOSED
gcsound.set/oldspeed = -1
lvuse gcsound.gc 1
setwintitle #this '$$lv.dir'
run 'guis:ext/gcsound/gcsound' ; load extension
xOnClose
guiclose #this
setgad #this 5 on ; appicon on
xOnQuit
guiquit gcsound.pop
guiquit gcsound.set
call gcsound quit
xOnRMB
if $mode = SAMPLE
guiopen gcsound.pop
else
; dir mode - quit any playing sounds
call gcsound stop ; stop all sounds
endif
xOnFail
guiwindow #this resume
xAppicon -1 -1 :gcsound.gc 'GCSound' '' OFF
gadid 5
guiopen #this
setgad #this 5 off
; ===============================================================
; the dir listview
; ===============================================================
XLISTVIEW 0 0 211 221 "" file "" 0 DIR
gadid 1
gadfont #mono 8 000
;LVColors 2 1 3 2 ; uncomment this line for genlocking
; on choosing a file by double click, play it..
if $file H= 'FORM????8SVX'
call gcsound sound $file 0 64 -1
ELSE
guiload guis:tools/rtn/filepop $file
endif
xlvdirhook 1
setwintitle #this '$$lv.dir'
; ===============================================================
; the samples listview - (should make it DBase)
; ===============================================================
XLISTVIEW 0 0 211 220 "" sample t:soundtemp 5 MULTI
gadid 10
gadfont #mono 8 000
;LVColors 2 1 3 2 ; uncomment this line for genlocking
gosub gcsound.gc splitline '$sample'
if $status = LOAD
call gcsound play $name $times $volume $speed
status = PLAY
gosub gcsound.gc joinline
lvput '$rec'
elseif $status = IDLE
call gcsound load $path $name
call gcsound play $name $times $volume $speed
status = PLAY
gosub gcsound.gc joinline
lvput '$rec'
endif
lvsort ASC
; ===============================================================
; dir lv control buttons
; ===============================================================
XBUTTON 212 0 20 12 "P"
gadid 50
lvuse #this 1
lvdir parent
setwintitle #this '$$lv.dir'
XBUTTON 212 12 20 12 "D"
gadid 50
lvuse #this 1
lvdir disks
setwintitle #this 'Disks'
XBUTTON 212 24 20 12 "S"
gadid 50
lvuse #this 1
if $selswitch = 1
lvdir all
selswitch = 0
else
lvdir none
selswitch = 1
endif
XBUTTON 212 44 20 12 "X"
gadhelp 'Delete selected files'
gadid 50
lvuse #this 1
lvaction delete ask
; ===============================================================
; dir lv - add selected
; ===============================================================
XBUTTON 212 64 20 12 +
gadhelp 'Add selected to list'
gadid 50
lvuse gcsound.gc 1
lvmulti first
while $$lv.line > '' ; skip dirs
and $$lv.type == DIR
lvmulti next
endwhile
while $$lv.line > '' ; skip dirs
if $file H= 'FORM????8SVX'
lvuse gcsound.gc 10
lvsearch '$file' ci first ; avoid duplicate entries
if $$lv.line = ''
extract file file fname
rec = ' '
rec[0][30] = $fname
appvar rec '0 64 -1 $file'
lvadd $rec
endif
lvuse gcsound.gc 1
endif
lvmulti off
lvmulti next
endwhile
; ===============================================================
; dir lv - switch to samples lv
; ===============================================================
XBUTTON 212 76 20 16 "Ok"
gadid 50
gcsound.gc/mode = SAMPLE
setgad gcsound.gc 10 SHOW ; show the samples lv
setgad gcsound.gc 2 SHOW ; show the textin gad
setgad gcsound.gc 1 HIDE ; hide dir lv
setgad gcsound.gc 50 HIDE ; hide all dir lv gads
redraw gcsound.gc
setwintitle gcsound.gc 'GCSound 8SVX player'
; ===============================================================
; Select lv - buttons
; ===============================================================
XBUTTON 212 0 20 12 "<"
Gadhelp 'Select samples'
gadid 2
gosub gcsound.pop dirmode
XBUTTON 212 16 20 12 "P"
Gadhelp 'Play selected samples'
gadid 2
gosub gcsound.pop playsamp
XBUTTON 212 28 20 12 "?"
Gadhelp 'Adjust sample'
gadid 2
lvuse gcsound.gc 10
lvmulti first
if $$lv.line > ''
gosub gcsound.set settings '$gcsound.gc/sample'
endif
XBUTTON 212 44 20 12 "U"
Gadhelp 'Unload all samples'
gadid 2
lvuse gcsound.gc 10
lvmulti all
setgad gcsound.gc 10 HIDE
guiwindow gcsound.gc wait
gosub gcsound.pop unload
setgad gcsound.gc 10 SHOW
guiwindow gcsound.gc resume
lvmulti none
XBUTTON 212 56 20 12 "R"
Gadhelp 'Remove selected from list'
gadid 2
gosub gcsound.pop remove
XBUTTON 212 72 20 12 "L"
Gadhelp 'Load new list'
gadid 2
local loadname
loadname = ''
ReqFile -1 -1 300 -40 'Load list:' SAVE loadname #$prefs
if $loadname > ''
lvuse #this 10
lvchange $loadname
prefs = $loadname
endif
XBUTTON 212 84 20 12 "S"
Gadhelp 'Save list'
gadid 2
local savename
savename = ''
ReqFile -1 -1 300 -40 'Save list:' SAVE savename #$prefs
if $savename > ''
lvuse #this 10
lvsave $savename
endif
; ===============================================================
; ROUTINE - Split the line into it's components
; ===============================================================
xRoutine splitline line
; split the line into it's components
origline = '$line' ; store original line
parsevar line
; get name & mode
name = $$parse.0
if $name[0][5] = '
'
status = LOAD
name = $name[5]
elseif $name[0][7] = '
'
status = PLAY
name = $name[7]
else
status = IDLE
endif
extract name clean name
times = $$parse.1
extract times clean times
volume = $$parse.2
extract volume clean volume
speed = $$parse.3
extract speed clean speed
path = $$parse.4
extract path clean path
if $setwin = OPEN
gosub gcsound.set initsetgads
endif
; ===============================================================
; ROUTINE - Join the line & put it back in the list
; ===============================================================
xRoutine joinline
rec = ' '
rec[0][30] = $name
appvar rec '$times $volume $speed $path'
; add esc seq
if $status = PLAY
rec = '
$rec'
elseif $status = LOAD
rec = '
$rec'
endif
; ===============================================================
; ROUTINE - find line place & put it
; ===============================================================
xRoutine putline
; look for old line & replace it
lvuse gcsound.gc 10
lvsearch '$path' ci first
if $$lv.line > ''
lvput '$rec'
else
ezreq 'Sample $name was removed!' OK ''
endif
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ###############################################################
NEWFILE gcsound.pop ; pop-up